
package cn.shuangliang.contract.service;

import cn.shuangliang.contract.dao.TypeMapper;
import cn.shuangliang.contract.model.Type;
import cn.shuangliang.contract.vo.Type2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
@Service
public class TypeService {
    @Resource
    private TypeMapper mapper;
    //获得顶层类型
    public List<Type2> getTop(String sidu,String style){

            return mapper.getTop(sidu,style);

    }

    public int add(Type type) {

            int r=mapper.checkRepeat(type.getSidu(),type.getStyle());
            if(r>0)
                return 0;
            return mapper.insertSelective(type);

    }
}

